package cn.zysuyuan.item.controller;

import cn.zysuyuan.common.entity.PageResult;
import cn.zysuyuan.item.entity.ProductBaseEdition;
import cn.zysuyuan.item.entity.ProductBaseImg;
import cn.zysuyuan.item.entity.ProductBaseImgEdition;
import cn.zysuyuan.item.service.ProductbaseEditionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.Map;

/**
 * @author flypig
 * @version 1.0
 * @date 2020-02-18 19:29
 */

@Api(tags = "产地产区归档管理")
@RestController
@RequestMapping("productbaseEdition")
public class ProductbaseEditionController {

    @Autowired
    private ProductbaseEditionService productbaseEditionService;

    @ApiOperation(value="归档基地的数据表格显示", notes="归档基地的数据表格显示")
    @GetMapping("productbaseEditionList")
    public ResponseEntity<PageResult<ProductBaseEdition>> select(@RequestParam Map<String,Object> map) {
        PageResult<ProductBaseEdition> result = productbaseEditionService.selectList(map);
        return ResponseEntity.ok(result);
    }

    @ApiOperation(value = "获取基地照片", notes = "获取基地照片")
    @GetMapping("productEditionImg")
    public ResponseEntity<PageResult<ProductBaseImgEdition>> selectListImg(@RequestParam("tProductbaseId") String tProductbaseId, @RequestParam("eTime") String eTime){
        PageResult result = this.productbaseEditionService.selectListImg(tProductbaseId,eTime);
        return ResponseEntity.ok(result);
    }

    @ApiOperation(value="获取药材列表来生成下拉栏", notes="select")
    @GetMapping("getMedicinalNamesEdition")
    public Map<String,Object> getMedicinalNamesEditionList(@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") Date eTime){
        System.out.print("s______________________________a:"+ eTime);
        return productbaseEditionService.selectMedicinalNamesEditionList(eTime);
    }
}
